setup base jwt authentication

This commit is contained in:
2025-01-06 21:34:23 +01:00
parent e91d6540bf
commit cf15e3beb3
12 changed files with 425 additions and 6 deletions

34
app/controllers/login.js Normal file
View File

@@ -0,0 +1,34 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
export default class LoginController extends Controller {
@tracked errorMessage;
@service session;
@action
async authenticate(e) {
e.preventDefault();
let { identification, password } = this;
try {
await this.session.authenticate('authenticator:jwt', identification, password);
} catch(error) {
this.errorMessage = error.error || error;
}
if (this.session.isAuthenticated) {
// What to do with all this success?
}
}
@action
updateIdentification(e) {
this.identification = e.target.value;
}
@action
updatePassword(e) {
this.password = e.target.value;
}
}