You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
733 B

import {
Controller,
view,
Inject,
Injectable,
SecurityContext,
redirect,
Valid,
BasicLoginAttempt,
BasicLoginProvider,
} from '@extollo/lib'
/**
* Login Controller
* ------------------------------------
* Put some description here.
*/
@Injectable()
export class Login extends Controller {
@Inject()
protected readonly security!: SecurityContext
public login() {
return view('auth:login')
}
public async attemptLogin(attempt: Valid<BasicLoginAttempt>) {
return this.make<BasicLoginProvider>(BasicLoginProvider)
.attemptLogin(attempt)
}
public async logout() {
await this.security.flush()
return redirect('/')
}
}