Kaydet (Commit) 9611def6 authored tarafından aliorhun's avatar aliorhun

First

üst 748cece0
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(hvl-lightdm-greeter)
add_subdirectory(src)
install(FILES hvl-lightdm-greeter.desktop DESTINATION /usr/share/xgreeters)
install(FILES hvl-lightdm-greeter.conf DESTINATION /usr/share/lightdm/lightdm-hvl-greeter.conf.d)
This diff is collapsed.
FROM ubuntu:18.04
RUN find / -name usersmodel.h
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
cmake \
lightdm \
build-essential \
qt5-default \
libqt5webenginewidgets5 \
qttools5-dev \
liblightdm-qt5-3-dev \
libqt5webengine5 \
libqt5webenginecore5 \
qtwebengine5-dev \
libxcursor1 \
libqt5x11extras5-dev \
libxcursor-dev \
libxrandr-dev
COPY . /hvl-lightdm-greeter
This diff is collapsed.
# Hvl Lightdm Greeter
[![Build Status](https://travis-ci.org/onurkepenek/Hvl-Lightdm-Greeter.svg?branch=master)](https://travis-ci.org/onurkepenek/Hvl-Lightdm-Greeter)
![GitHub All Releases](https://img.shields.io/github/downloads/aciklab/Hvl-Lightdm-Greeter/total.svg)
![GitHub release](https://img.shields.io/github/release/aciklab/Hvl-Lightdm-Greeter.svg)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/aciklab/Hvl-Lightdm-Greeter.svg)
![GitHub last commit](https://img.shields.io/github/last-commit/aciklab/Hvl-Lightdm-Greeter.svg)
![GitHub](https://img.shields.io/github/tag/aciklab/Hvl-Lightdm-Greeter.svg)
![GitHub](https://img.shields.io/github/license/aciklab/Hvl-Lightdm-Greeter.svg)
# hvl-lightdm-greeter
[ENGLISH](https://github.com/aciklab/Hvl-Lightdm-Greeter/blob/master/README_EN.md)
## Tanım
hvl-lightdm-greeter, lightdm yüklü sistemlerde kullanılabilecek bir giriş ekranı uygulamasıdır. [qt-lightdm-greeter](https://github.com/surlykke/qt-lightdm-greeter) 'dan esinlenilerek c++ ve qt ile yazılmıştır.
Bu giriş ekranı, süresi dolmuş parolaları sıfırlama imkanı verebilmektedir (Windows aktif dizin hesapları ve yerel kullanıcı hesapları ile test edilmiştir).
Eğer bir parolanın değiştirlmesi gerekiyorsa giriş sırasında kullanıcının parolasını sıfırlaması istenir. Arkasından parola sıfırlama sayfası açılarak kullanıcının parolasını sıfırlaması sağlanır.
Giriş ekranı Pardus 17.4 ve Xubuntu 18.04'de test edilmiştir.
`Giriş ekranı`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/loginpage_tr.jpg" width="300" height="300">
`Kullanıcı seçimi`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/userspage_tr.jpg" width="400" height="300">
`Parola sıfırlama uyarısı`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/prompt_tr.jpg" width="300" height="300">
`Parola sıfırlama Sayfası`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/reset_tr.jpg" width="300" height="300">
## Kurulum
### Derleme
Kodu derlemek için,
- qt5-default
- cmake
- qtwebengine5-dev
- libqt5x11extras5-dev
- liblightdm-qt5-3-dev
- libxcursor-dev
- libxrandr-dev
- lightdm
- qttools5-dev-tools
paketlerinin sisteminizde kurulu olduğuna emin olun
Çalıştırmak için bağımlılıklar şunlardır: lightdm, libqt5webenginewidgets5, liblightdm-qt5-3-0, libqt5webengine5, libx11-6, libxcursor1, libqt5x11extras5
Kurlum için, aşağıdaki komutları çalıştırın:
```shell
git clone https://github.com/mertcelen/Hvl-Lightdm-Greeter.git
cd Hvl-Lightdm-Greeter
mkdir build
cd build
cmake ..
make
sudo make install
```
`/etc/lightdm/lightdm.conf`, dosyası içinde, `SeatDefaults` bölümü altına aşağıdaki satırı ekleyin ya da başka bir değere atanmışsa güncelleyin:
greeter-session=hvl-lightdm-greeter
Eğer böyle bir dosya mevcut değilse oluşturun.
### Pardus Onyedi üzerine kurulum
```sudo echo "deb [arch=amd64] http://acikdepo.github.io/ onyedi main" > /etc/apt/sources.list.d/acikdepo.list
sudo wget -qO - https://raw.githubusercontent.com/acikdepo/acikdepo.github.io/master/public.key | sudo apt-key add -
sudo apt update
sudo apt install lightdm-hvl-greeter
```
## Yapılandırma
`/usr/share/lightdm/lightdm-hvl-greeter.conf.d/hvl-lightdm-greeter.conf` dosyası içinde kullanılabilecek çeşitli konfigürasyon seçenekleri bulunmaktadır. Örnek olarak:
-Arka plan resmi,
-Giriş, saat ve ayar formlarının pozisyonları,
-Beklenmesi gereken servisler vb..
Bu dosya içinde detaylı açıklamalar yapılmıştır.
# hvl-lightdm-greeter
[TÜRKÇE](https://github.com/aciklab/Hvl-Lightdm-Greeter/)
## Destination
hvl-lightdm-greeter is a login application for the lightdm displaymanager, written in c++ and qt5. This project inspired by [qt-lightdm-greeter](https://github.com/surlykke/qt-lightdm-greeter)
This greeter provides to reset expired passwords (Tested with Windows active directory accounts and local accounts). If a password expired. greeter opens password reset page and prompt user to reset password.
Tested on Pardus 17.4 and Xubuntu 18.04
`Login screen`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/loginpage_tr.jpg" width="300" height="300">
`Users screen`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/userspage_en.jpg" width="400" height="300">
`Prompt screen`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/prompt_en.jpg" width="300" height="300">
`Password reset screen`
<img src="https://github.com/aciklab/Hvl-Lightdm-Greeter/raw/master/ss/reset_en.jpg" width="300" height="300">
## Installing
### Compile
For building, make sure you have;
- qt5-default
- cmake
- qtwebengine5-dev
- libqt5x11extras5-dev
- liblightdm-qt5-3-dev
- libxcursor-dev
- libxrandr-dev
- lightdm
- qttools5-dev-tools
installed on your system
For running, dependencies are : lightdm, libqt5webenginewidgets5, liblightdm-qt5-3-0, libqt5webengine5, libx11-6, libxcursor1, libqt5x11extras5
To install, do:
```shell
git clone https://github.com/mertcelen/Hvl-Lightdm-Greeter.git
cd Hvl-Lightdm-Greeter
mkdir build
cd build
cmake ..
make
sudo make install
```
Update or insert in(to) your `/etc/lightdm/lightdm.conf`, in the `SeatDefaults` section, this line:
greeter-session=hvl-lightdm-greeter
If this file is not exist create new one.
### on Pardus Onyedi
```sudo echo "deb [arch=amd64] http://acikdepo.github.io/ onyedi main" > /etc/apt/sources.list.d/acikdepo.list
sudo wget -qO - https://raw.githubusercontent.com/acikdepo/acikdepo.github.io/master/public.key | sudo apt-key add -
sudo apt update
sudo apt install lightdm-hvl-greeter
```
## Configuration
The file `/usr/share/lightdm/lightdm-hvl-greeter.conf.d/hvl-lightdm-greeter.conf` allows to configure hvl-lightdm-greeter. For example:
-background-image,
-positioning of loginform, settingsform and clockform.
-System services to wait etc.
The configuration options are documented in that file.
; hvl-lightdm-greeter.conf
;
; General configuration
;
; greeter-icon-theme = name of icon theme to use for the greeter
;
; greeter-background-image-dir /path/to/background-dir/ directory contains background images in jpg and png format. Images selected randomly at the start of the program
; greeter-background-image = image file name in the greeter-background-image-dir to set a background image for the login screen
;
; loginform-offset-x = how far from the left edge of the screen should the loginform be placed.
; Can be given in pixels, e.g. loginform-offset-x=60px, or in percentage of screen width, e.g. loginform-offset-x=20%.
;
; loginform-offset-y = how far from the left edge of the screen should the loginform be placed.
; Can be given in pixels, e.g. loginform-offset-y=60px, or in percentage of screen height, e.g. loginform-offset-y=20%.
; password-web-reset = set to 1 if you want to show password reset web page button. Otherwise set to 0
; password-web-reset-webpage = url for the password reset we bpage
; password-web-reset-webpage-offset-x
; password-web-reset-webpage-offset-y
; password-web-reset-webpage-size-x
; password-web-reset-webpage-size-y
;
; settingsform-offset-x = same format with loginform-offset-x
; settingsform-offset-y = same format with loginform-offset-y
; clockform-offset-x = same format with loginform-offset-x
; clockform-offset-y = same format with loginform-offset-y
; clockform-size-x = Width size of the clockform. Can be given in pixels, e.g. clockform-size-x-y=600px, or in percentage of screen width, e.g. clockform-size-x=10%.
; clockform-size-y = Height of the clockform. Can be given in pixels, e.g. clockform-size-x-y=600px, or in percentage of screen height, e.g. clockform-size-x=10%.
; services-to-check = System services to wait to start before let the user login. Should be in this format, services-to-check="Service1", "service2"
; wait-timeout = Timeout for service check. If the all services doesn't start after this timeout, user can try to login
; cached-user-count = Configuration to show how many users on the user selection page. Maximum value is 5
[General]
greeter-icon-theme=pardus-dark
greeter-background-image-dir =/usr/share/lightdm/lightdm-hvl-greeter.conf.d/resources/bgs/
loginform-offset-x=50%
loginform-offset-y=30%
settingsform-offset-x=50%
settingsform-offset-y=75%
clockform-offset-x=3%
clockform-offset-y=5%
clockform-size-x=20%
clockform-size-y=20%
password-web-reset = 0
services-to-check="NetworkManager"
wait-timeout= 5
network-ok-timeout=0
cached-user-count = 5
screen_keyboard = y
\ No newline at end of file
[Desktop Entry]
Name=Hvl LightDM Greeter
Comment=This runs the Hvl LightDM greeter, it should only be run from LightDM
Exec=hvl-lightdm-greeter --no-sandbox
Type=Application
X-Ubuntu-Gettext-Domain=lightdm
<RCC>
<qresource prefix="/">
<file>resources/dropdown.svg</file>
<file>resources/leaveIcon.svg</file>
<file>resources/pardus.png</file>
<file>settings.cpp</file>
<file>resources/load1.gif</file>
<file>resources/eye.png</file>
<file>resources/ethernet-off.png</file>
<file>resources/ethernet-on.png</file>
<file>resources/keyboard.png</file>
<file>resources/avatar-default.png</file>
</qresource>
</RCC>
This diff is collapsed.
set(PROJECT hvl-lightdm-greeter)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(LIGHTDM_QT_LIBRARIES /usr/lib/x86_64-linux-gnu/liblightdm-qt5-3.so)
set(LIGHTDM_QT_INCLUDE_DIRS /usr/include/lightdm-qt5-3)
set(LIGHTDM_X11_LIBRARIES /usr/lib/x86_64-linux-gnu/libX11.so)
set(LIGHTDM_X11_EXTRA_LIBRARIES /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so)
set(LIGHTDM_XCURSOR_LIBRARIES /usr/lib/x86_64-linux-gnu/libXcursor.so /usr/lib/x86_64-linux-gnu/libXrandr.so)
file(GLOB SRCS *.cpp *ui *moc)
message(STATUS "SRCS ${SRCS}")
find_package (Threads REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5WebEngine REQUIRED)
find_package(Qt5WebEngineCore REQUIRED)
find_package(Qt5WebEngineWidgets REQUIRED)
find_package(Qt5LinguistTools)
find_package(Qt5X11Extras REQUIRED)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_definitions(-DUNIX)
add_definitions(-D_LIB)
add_definitions(-DNDEBUG)
QT5_ADD_RESOURCES(RSCS hvl-lightdm-greeter.qrc)
include(FindPkgConfig)
pkg_check_modules(LIGHTDM_QT liblightdm-qt5-3)
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${LIGHTDM_QT_INCLUDE_DIRS}
)
file(GLOB TS_FILES ../languages/*.ts)
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations DEPENDS ${QM_FILES})
add_executable (hvl-lightdm-greeter ${SRCS} ${RSCS} ${QM_FILES})
target_link_libraries ( hvl-lightdm-greeter Qt5::Widgets Qt5::Network Qt5::WebEngine Qt5::WebEngineCore Qt5::Quick Qt5::WebEngineWidgets ${LIGHTDM_QT_LIBRARIES} ${LIGHTDM_X11_LIBRARIES} ${LIGHTDM_X11_EXTRA_LIBRARIES} ${LIGHTDM_XCURSOR_LIBRARIES})
install(TARGETS ${PROJECT} RUNTIME DESTINATION bin)
install(FILES ${QM_FILES} DESTINATION /usr/share/lightdm/lightdm-hvl-greeter.conf.d/lang)
#include "clockform.h"
#include "ui_clockform.h"
#include <QLightDM/UsersModel>
#include <QNetworkInterface>
#include <QTimer>
#include <QToolTip>
#include <QLabel>
#include <QTextBrowser>
#include <QDateTime>
clockForm::clockForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::clockForm)
{
ui->setupUi(this);
timer = new QTimer();
timer->setTimerType(Qt::TimerType::CoarseTimer);
timer->setSingleShot(false);
updateClock();
timer->setInterval(10);
timer->start();
connect(timer, SIGNAL(timeout()), this, SLOT(updateClock()));
resized = false;
}
clockForm::~clockForm()
{
delete ui;
delete timer;
}
void clockForm::updateClock(){
timer->stop();
QDateTime *qdt = new QDateTime();
QString tempstring;
tempstring = qdt->currentDateTime().toString("hh:mm");
ui->clockLabel->setText(tempstring);
tempstring = qdt->currentDateTime().toString("dddd");
ui->dayLabel->setText(tempstring);
tempstring = qdt->currentDateTime().toString(Qt::SystemLocaleShortDate);
//tempstring = qdt->currentDateTime().toString("dd.MM.yyyy");
ui->dateLabel->setText(tempstring.section(' ', 0,0));
timer->setInterval(1000);
timer->start();
QFont font("Source Code Pro");
font.setPointSize(50);//gm_edition 100
ui->clockLabel->setFont(font);
font.setPointSize(20); //gm_edition 40
ui->dayLabel->setFont(font);
font.setPointSize(30); //gm_edition 60
ui->dateLabel->setFont(font);
#if 0
if(!resized){
QFont font("Source Code Pro");
font.setPointSize((ui->clockLabel->height() * 6 ) / 10);
ui->clockLabel->setFont(font);
font.setPointSize(ui->dayLabel->height()/2);
ui->dayLabel->setFont(font);
font.setPointSize((ui->dateLabel->height() * 5) / 10);
ui->dateLabel->setFont(font);
resized = true;
}
#endif
}
#ifndef CLOCKFORM_H
#define CLOCKFORM_H
#include <QWidget>
#include <QTimer>
#include "main.h"
namespace Ui {
class clockForm;
}
class clockForm : public QWidget
{
Q_OBJECT
private slots:
void updateClock();
public:
explicit clockForm(QWidget *parent = 0);
~clockForm();
bool resized;
private:
Ui::clockForm *ui;
QTimer *timer;
};
#endif // CLOCKFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>clockForm</class>
<widget class="QWidget" name="clockForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>309</width>
<height>221</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget {
border-radius: 5px;
}
#frame{
border:0px solid rgba(255,255,255,0.5);
}
#dayLabel,
#clockLabel,
#dateLabel {
color: white;
text-align: center;
}
#frame {
background-color: rgba(80,80,80, 0.0);
border-radius: 0px;
}
</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">
#dayLabel,
#clockLabel,
#dateLabel {
color: white;
text-align: center;
}</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="5,2,3">
<item>
<widget class="QLabel" name="clockLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
</size>
</property>
<property name="font">
<font>
<family>Source Code Pro</family>
<pointsize>50</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>13:56</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dayLabel">
<property name="font">
<font>
<family>Source Code Pro</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>Cumartesi</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dateLabel">
<property name="font">
<font>
<family>Source Code Pro</family>
<pointsize>30</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>21.15.18</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
This diff is collapsed.
#include "dialog_webview.h"
#include "ui_dialog_webview.h"
#include <QtWebEngine/QtWebEngine>
#include <QtWebEngineCore/QtWebEngineCore>
#include <QtWebEngineWidgets/QtWebEngineWidgets>
#include <QQmlApplicationEngine>
#include "mainwindow.h"
#include "loginform.h"
#include "settings.h"
Dialog_webview::Dialog_webview(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_webview)
{
ui->setupUi(this);
QtWebEngine::initialize();
setFixedHeight(700 + ui->closebutton->width() + 1);
setFixedWidth(1024);
ui->widget1->setFixedHeight(700);
ui->widget1->setFixedWidth(1024);
ui->widget1->move(0, ui->closebutton->width());
ui->widget1->setGeometry(0,0,1024,700);//position on screen
ui->closebutton->move(1024 - ui->closebutton->width() - 1, 0);
QString tmpurl = checkPasswordResetWebPage();
if(!tmpurl.isEmpty() && !tmpurl.isNull()){
ui->widget1->load(QUrl(tmpurl,QUrl::ParsingMode::TolerantMode));
//ui->widget1->setFocus();
qInfo() << "Opening webpage " + tmpurl + " now";
}else{
qCritical() << "Failed to opening webpage " + tmpurl;
}
}
Dialog_webview::~Dialog_webview()
{
delete ui;
}
QString Dialog_webview::checkPasswordResetWebPage(){
QString ret_string;
QSettings greeterSettings(CONFIG_FILE, QSettings::IniFormat);
if (greeterSettings.contains(PASSWORD_RESET_WEBPAGE_KEY)) {
ret_string = greeterSettings.value(PASSWORD_RESET_WEBPAGE_KEY).toString();
}
return ret_string;
}
void Dialog_webview::Initialize(){
}
void Dialog_webview::on_closebutton_clicked()
{
close();
}
#ifndef DIALOG_WEBVIEW_H
#define DIALOG_WEBVIEW_H
#include <QDialog>
#include <QtWebEngine/QtWebEngine>
#include <QtWebEngineCore/QtWebEngineCore>
#include <QtWebEngineWidgets/QtWebEngineWidgets>
#include <QQmlApplicationEngine>
namespace Ui {
class Dialog_webview;
}
class Dialog_webview : public QDialog
{
Q_OBJECT
public:
explicit Dialog_webview(QWidget *parent = 0);
~Dialog_webview();
private slots:
void on_closebutton_clicked();
private:
QString checkPasswordResetWebPage();
void Initialize();
Ui::Dialog_webview *ui;
QWebEngineView *viewx;
};
#endif // DIALOG_WEBVIEW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_webview</class>
<widget class="QDialog" name="Dialog_webview">