Fix minor issues

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-08-18 17:03:39 +02:00
parent 459c9e0454
commit 47b01c6639
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
4 changed files with 10 additions and 5 deletions

View File

@ -131,7 +131,11 @@ class RegisterController extends Controller {
); );
} }
return new TemplateResponse('registration', 'form', ['email' => $registration->getEmail(), 'token' => $registration->getToken()], 'guest'); return new TemplateResponse('registration', 'form', [
'email' => $registration->getEmail(),
'email_is_login' => $this->config->getAppValue('registration', 'email_is_login', '0') === '1',
'token' => $registration->getToken(),
], 'guest');
} catch (RegistrationException $exception) { } catch (RegistrationException $exception) {
return $this->renderError($exception->getMessage(), $exception->getHint()); return $this->renderError($exception->getMessage(), $exception->getHint());
} }
@ -147,7 +151,7 @@ class RegisterController extends Controller {
public function createAccount($token) { public function createAccount($token) {
$registration = $this->registrationService->getRegistrationForToken($token); $registration = $this->registrationService->getRegistrationForToken($token);
if ($this->config->getAppValue('registration', 'email_is_login', '0') === '1') { if ($this->config->getAppValue('registration', 'email_is_login', '0') === '1') {
$username = $registration->email; $username = $registration->getEmail();
} else { } else {
$username = $this->request->getParam('username'); $username = $this->request->getParam('username');
} }

View File

@ -47,7 +47,7 @@ use OCP\AppFramework\Db\Entity;
*/ */
class Registration extends Entity { class Registration extends Entity {
public $id; public $id;
public $email; protected $email;
protected $username; protected $username;
protected $displayname; protected $displayname;
protected $password; protected $password;

View File

@ -23,7 +23,7 @@ script('registration', 'form');
<img id="email-icon" class="svg" src="<?php print_unescaped(image_path('', 'actions/mail.svg')); ?>" alt=""/> <img id="email-icon" class="svg" src="<?php print_unescaped(image_path('', 'actions/mail.svg')); ?>" alt=""/>
</p> </p>
<?php if ( \OC::$server->getConfig()->getAppValue('registration', 'email_is_login', '0') !== '1' ) { ?> <?php if ($_['email_is_login']) { ?>
<p class="groupmiddle"> <p class="groupmiddle">
<input type="text" name="username" id="username" value="<?php if (!empty($_['entered_data']['user'])) { <input type="text" name="username" id="username" value="<?php if (!empty($_['entered_data']['user'])) {
p($_['entered_data']['user']); p($_['entered_data']['user']);
@ -31,7 +31,7 @@ script('registration', 'form');
<label for="username" class="infield"><?php p($l->t('Username')); ?></label> <label for="username" class="infield"><?php p($l->t('Username')); ?></label>
<img id="username-icon" class="svg" src="<?php print_unescaped(image_path('', 'actions/user.svg')); ?>" alt=""/> <img id="username-icon" class="svg" src="<?php print_unescaped(image_path('', 'actions/user.svg')); ?>" alt=""/>
</p> </p>
<?php } ?> <?php } ?>
<p class="groupbottom"> <p class="groupbottom">
<input type="password" name="password" id="password" placeholder="<?php p($l->t('Password')); ?>"/> <input type="password" name="password" id="password" placeholder="<?php p($l->t('Password')); ?>"/>

View File

@ -108,6 +108,7 @@ class RegisterControllerTest extends TestCase {
$this->request, $this->request,
$this->l10n, $this->l10n,
$this->urlGenerator, $this->urlGenerator,
$this->config,
$this->registrationService, $this->registrationService,
$this->mailService $this->mailService
); );