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) {
return $this->renderError($exception->getMessage(), $exception->getHint());
}
@ -147,7 +151,7 @@ class RegisterController extends Controller {
public function createAccount($token) {
$registration = $this->registrationService->getRegistrationForToken($token);
if ($this->config->getAppValue('registration', 'email_is_login', '0') === '1') {
$username = $registration->email;
$username = $registration->getEmail();
} else {
$username = $this->request->getParam('username');
}

View File

@ -47,7 +47,7 @@ use OCP\AppFramework\Db\Entity;
*/
class Registration extends Entity {
public $id;
public $email;
protected $email;
protected $username;
protected $displayname;
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=""/>
</p>
<?php if ( \OC::$server->getConfig()->getAppValue('registration', 'email_is_login', '0') !== '1' ) { ?>
<?php if ($_['email_is_login']) { ?>
<p class="groupmiddle">
<input type="text" name="username" id="username" value="<?php if (!empty($_['entered_data']['user'])) {
p($_['entered_data']['user']);

View File

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