public function actionIndex()
 {
     // redirect logged in users
     if (!Yii::$app->adminuser->isGuest) {
         return $this->redirect(Url::base(true) . '/admin');
     }
     $this->view->registerJs("\$(function(){ \$('#email').focus(); observeLogin('#loginForm', '" . Url::toAjax('admin/login/async') . "', '" . Url::toAjax('admin/login/async-token') . "'); });", \luya\web\View::POS_END);
     return $this->render('index');
 }
Exemple #2
0
 /**
  * Generate the Link Tag.
  *
  * @param string $value The Brackets value `[]`.
  * @param string $sub The optional Parentheses value `()`
  * @see \luya\tag\TagInterface::parse()
  * @return string The parser tag.
  */
 public function parse($value, $sub)
 {
     if (substr($value, 0, 2) == '//') {
         $value = StringHelper::replaceFirst('//', Url::base(true) . '/', $value);
         $external = false;
     } else {
         $external = true;
     }
     $value = Url::ensureHttp($value);
     $label = empty($sub) ? $value : $sub;
     return Html::a($label, $value, ['class' => $external ? 'link-external' : 'link-internal', 'target' => $external ? '_blank' : null]);
 }
 public function sendMail($message, $email, $name)
 {
     $email = Html::encode($email);
     $name = Html::encode($name);
     $html = "<p>You have recieved an E-Mail via Form Block on " . Url::base(true) . "</p>";
     $html .= "<p>From: " . $name . " ({$email})<br />Time:" . date("d.m.Y - H:i") . "<br />";
     $html .= "Message:<br />" . nl2br(Html::encode($message)) . "</p>";
     $mail = Yii::$app->mail;
     $mail->fromName = $name;
     $mail->from = $email;
     $mail->compose($this->getVarValue('subjectText', $this->defaultMailSubject), $html);
     $mail->address($this->getVarValue('emailAddress'));
     if (!$mail->send()) {
         return 'Error: ' . $mail->error;
     } else {
         return 'success';
     }
 }
 public function actionIndex()
 {
     $url = Url::base(true) . '/admin';
     // redirect logged in users
     if (!Yii::$app->adminuser->isGuest) {
         return $this->redirect($url);
     }
     // get the login form model
     $model = new \admin\models\LoginForm();
     // see if values are sent via post
     if (Yii::$app->request->post('login')) {
         $model->attributes = Yii::$app->request->post('login');
         if (($userObject = $model->login()) !== false) {
             if (Yii::$app->adminuser->login($userObject)) {
                 return $this->redirect($url);
             }
         }
     }
     $this->view->registerJs("\$(function(){ \$('#email').focus(); observeLogin('#loginForm', '" . Url::toAjax('admin/login/async') . "', '" . Url::toAjax('admin/login/async-token') . "'); });", \luya\web\View::POS_END);
     return $this->render('index', ['model' => $model]);
 }
Exemple #5
0
use yii\helpers\Markdown;
$user = Yii::$app->adminuser->getIdentity();
$this->beginPage();
?>
<!DOCTYPE html>
<html ng-app="zaa" ng-controller="LayoutMenuController">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title><?php 
echo Yii::$app->siteTitle;
?>
 &rsaquo; {{currentItem.alias}}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="<?php 
echo Url::base(true);
?>
/admin" />
    <style type="text/css">
        [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
  			display: none !important;
		}
		
		.dragover {
		    border: 5px dashed #2196F3;
		}
    </style>
    <?php 
$this->head();
?>
</head>
 public function actionLogout()
 {
     Yii::$app->adminuser->logout();
     return $this->redirect(Url::base(true) . '/admin/login');
 }
 /**
  * Get the base absolute base path to the storage directory.
  *
  * @return string Get the absolute http path to the storage folder if nothing is provided by the setter method `setAbsoluteHttpPath()`.
  * @since 1.0.0-beta7
  */
 public function getAbsoluteHttpPath()
 {
     if ($this->_absoluteHttpPath === null) {
         $this->_absoluteHttpPath = Url::base(true) . '/storage';
     }
     return $this->_absoluteHttpPath;
 }