fix: minor bugfixes in the authentication process
This commit is contained in:
parent
66bbb57548
commit
99098dd9cf
5 changed files with 8 additions and 9 deletions
|
|
@ -75,7 +75,7 @@ class RegisterView(APIView):
|
||||||
|
|
||||||
message = EmailMultiAlternatives(
|
message = EmailMultiAlternatives(
|
||||||
subject='Confirm your email',
|
subject='Confirm your email',
|
||||||
body=strip_tags(html_body), # Plain text fallback
|
body=strip_tags(html_body),
|
||||||
from_email=settings.DEFAULT_FROM_EMAIL,
|
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||||
to=[user.email]
|
to=[user.email]
|
||||||
)
|
)
|
||||||
|
|
@ -153,7 +153,6 @@ class ChangePasswordView(APIView):
|
||||||
|
|
||||||
class AuthView(ObtainAuthToken):
|
class AuthView(ObtainAuthToken):
|
||||||
authentication_classes = [authentication.TokenAuthentication]
|
authentication_classes = [authentication.TokenAuthentication]
|
||||||
permission_classes = [permissions.IsAuthenticated]
|
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ export class ForgotPasswordComponent implements OnInit {
|
||||||
|
|
||||||
async verifyEmail() {
|
async verifyEmail() {
|
||||||
const body = {
|
const body = {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail.toLowerCase(),
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
this.authData.send = true;
|
this.authData.send = true;
|
||||||
|
|
@ -84,7 +84,7 @@ export class ForgotPasswordComponent implements OnInit {
|
||||||
|
|
||||||
async changePassword() {
|
async changePassword() {
|
||||||
const body = {
|
const body = {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail.toLowerCase(),
|
||||||
token: this.authData.token,
|
token: this.authData.token,
|
||||||
new_password: this.authData.password,
|
new_password: this.authData.password,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ export class LandingPageComponent {
|
||||||
|
|
||||||
async checkDuplicatesEmail() {
|
async checkDuplicatesEmail() {
|
||||||
const body = {
|
const body = {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail.toLowerCase(),
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
this.authData.send = true;
|
this.authData.send = true;
|
||||||
await this.authService.checkAuthUserMail(body);
|
await this.authService.checkAuthUserMail(body);
|
||||||
const queryParams = { mail: this.authData.mail };
|
const queryParams = { mail: this.authData.mail.toLowerCase() };
|
||||||
this.router.navigate(['/register'], { queryParams });
|
this.router.navigate(['/register'], { queryParams });
|
||||||
this.errorService.clearError();
|
this.errorService.clearError();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export class RegisterComponent implements OnInit {
|
||||||
async onSubmit(ngForm: NgForm) {
|
async onSubmit(ngForm: NgForm) {
|
||||||
if (ngForm.submitted && ngForm.form.valid) {
|
if (ngForm.submitted && ngForm.form.valid) {
|
||||||
const body = {
|
const body = {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail.toLowerCase(),
|
||||||
username: this.authData.mail.split('@')[0],
|
username: this.authData.mail.split('@')[0],
|
||||||
password: this.authData.password,
|
password: this.authData.password,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class VerifyEmailComponent {
|
||||||
|
|
||||||
async verifyEmail() {
|
async verifyEmail() {
|
||||||
const body = {
|
const body = {
|
||||||
email: this.authData.mail,
|
email: this.authData.mail.toLowerCase(),
|
||||||
token: this.authData.token,
|
token: this.authData.token,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue