Finish server-side translations in controllers

This commit is contained in:
garrettmills
2020-05-30 20:16:10 -05:00
parent 86878efb52
commit d2ae9c43e8
26 changed files with 225 additions and 394 deletions

View File

@@ -13,7 +13,7 @@ class Oauth2 extends Oauth2Controller {
async authorize_post(req, res, next) {
const client = await this._get_authorize_client({query: req.body})
if ( !client ) return this._uniform(res, 'Unable to authorize client application. The application config is invalid. Please check the client ID and redirect URI and try again.')
if ( !client ) return this._uniform(res, req.T('unable_to_authorize'))
const StarshipClient = this.models.get('oauth:Client')
const starship_client = await StarshipClient.findOne({ active: true, uuid: client.clientID })
@@ -25,7 +25,7 @@ class Oauth2 extends Oauth2Controller {
async authorize_get(req, res, next) {
const client = await this._get_authorize_client(req)
if ( !client ) return this._uniform(res, 'Unable to authorize client application. The application config is invalid. Please check the client ID and redirect URI and try again.')
if ( !client ) return this._uniform(res, req.T('unable_to_authorize'))
const uri = new URL(req.query.redirect_uri)
const StarshipClient = this.models.get('oauth:Client')
@@ -46,18 +46,18 @@ class Oauth2 extends Oauth2Controller {
...this.Vue.data({
message: `<h3 class="font-weight-light">Authorize ${client.name}?</h3>
<br>
${client.name} is requesting access to your ${this.configs.get('app.name')} account. Once you grant it, you may not be prompted for permission again.
${req.T('auth.oauth_prompt').replace('CLIENT_NAME', client.name).replace('APP_NAME', this.configs.get('app.name'))}
<br><br><br>
<i><small>You will be redirected to: ${uri.host}</small></i>`,
<i><small>${req.T('auth.will_redirect')} ${uri.host}</small></i>`,
actions: [
{
text: 'Deny',
text: req.T('common.deny'),
action: 'redirect',
next: '/dash',
},
{
text: 'Grant Access',
text: req.T('common.grant'),
action: 'post',
params: {
redirect_uri: uri.toString(),